#include <tchar.h>
#include <memory>

#include "game.h"
#include <windows.h>

using namespace NOEXIT;
using namespace std;
int APIENTRY _tWinMain(HINSTANCE hInstance,
	HINSTANCE,
	LPTSTR,
	int)
{
	_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
	_CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_DEBUG );

	try
	{
		shared_ptr<Game> GameInstance(new Game(hInstance));
		GameInstance->run();
	}
	catch(NBEException& e)
	{
		//inform user
		shared_ptr<char> tempChar(TypeCast::intToChar( e.ErrorCode() ));
		shared_ptr<wchar_t> codeWchar( TypeCast::charToWchar( tempChar.get() ) );
		::MessageBox(nullptr, codeWchar.get(),L"Error Code",MB_OK|MB_ICONERROR);
		 
	 
	}
	return 0;
}